<template>
	<div class="bigDiv">
		<el-form :inline="true" label-width="100px">
			<div class="topNav">
				<el-button type="text" icon="el-icon-search" @click="getList" style="float:right;">搜索</el-button>
				<el-button type="text" icon="el-icon-refresh" @click="reset"
					style="float:right;margin-right:10px;">重置</el-button>
				<el-button type="text" icon="el-icon-plus" @click="editProduct">新增巡查</el-button>
				<!-- <el-button type="text" @click="exportIt">导出</el-button> -->
			</div>
			<el-form-item label="巡查单编号" prop="seq_no">
				<el-input v-model="queryParams.seq_no" placeholder="请输入巡查单编号" clearable size="small"
					@keyup.enter.native="getList" />
			</el-form-item>
			<el-form-item label="小区编码" prop="block">
				<el-input v-model="queryParams.block" placeholder="请输入小区编码" clearable size="small"
					@keyup.enter.native="getList" />
			</el-form-item>
		</el-form>
		<el-table v-loading="loading" :data="list" border height="calc(100vh - 320px)">
			<!-- <el-table-column label="id" align="center" prop="id" fixed="left"></el-table-column> -->
			<el-table-column label="巡检单编号" align="center" prop="seqNo"></el-table-column>
			<el-table-column label="健身设施" align="center" prop="desFitnessFacilities"></el-table-column>
			<el-table-column label="雨污水井" align="center" prop="desRainwaterWells"></el-table-column>
			<el-table-column label="水箱间" align="center" prop="desWaterTank"></el-table-column>
			<el-table-column label="变电所" align="center" prop="desSubstation"></el-table-column>
			<el-table-column label="公共照明" align="center" prop="desPublicLighting"></el-table-column>
			<el-table-column label="路面" align="center" prop="desPavement"></el-table-column>
			<el-table-column label="公共区域" align="center" prop="desPublicAreas"></el-table-column>
			<el-table-column label="楼宇门" align="center" prop="desBuildingDoors"></el-table-column>
			<el-table-column label="泵房" align="center" prop="desPumpRoom"></el-table-column>
			<el-table-column label="儿童游乐场" align="center" prop="desPlayground"></el-table-column>
			<el-table-column label="创建者" align="center" prop="createBy"></el-table-column>
			<el-table-column label="创建时间" align="center" prop="createTime"></el-table-column>
			<el-table-column label="更新者" align="center" prop="updateBy"></el-table-column>
			<el-table-column label="更新时间" align="center" prop="updateTime"></el-table-column>
			<el-table-column label="小区编号" align="center" prop="block"></el-table-column>
			<el-table-column label="备注" align="center" prop="remark"></el-table-column>
			<el-table-column label="操作" align="center" width="200" fixed="right">
				<template slot-scope="scope">
					<div class="centered-content">
						<el-button type="text" size="mini" class="editBtn" @click="editProduct(scope.row)">
							编辑
						</el-button>
						<el-button type="text" size="mini" class="deleteBtn" @click="delProduct(scope.row)">
							删除
						</el-button>
					</div>
				</template>
			</el-table-column>
		</el-table>
		<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
			:limit.sync="queryParams.pageSize" @pagination="getList" />
		<!-- 弹窗 -->
		<el-dialog title="新增巡查" :visible.sync="visible" :close-on-click-modal="false" :close-on-press-escape="false"
			width="40%">
			<el-form ref="form" :model="dataForm" :rules="rules" label-width="90px">
				<!-- <el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="创建者" prop="createBy">
							<el-input v-model="dataForm.createBy" placeholder="请输入创建者" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.createBy)"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="小区编号" prop="useSquare">
							<el-input v-model="dataForm.block" placeholder="小区编号" clearable :style="{ width: '100%' }"
								:maxlength="10" @input="/^\d+(.\d{1,2})?$/.test(dataForm.block)"></el-input>
						</el-form-item>
					</el-col>
				</el-row> -->
				<el-row :gutter="20">
					<el-col :span="24">
						<el-form-item label="巡检单编号" prop="seqNo">
							<el-input v-model="dataForm.seqNo" placeholder="请输入巡检单编号" clearable disabled
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.seqNo)"></el-input>
						</el-form-item>
					</el-col>

				</el-row>

				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="健身设施" prop="desFitnessFacilities">
							<!-- <el-select v-model="dataForm.desFitnessFacilities" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desFitnessFacilities" placeholder="请输入健身设施" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desFitnessFacilities)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desFitnessFacilities')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desFitnessFacilities')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesFitnessFacilities" list-type="picture" :preview-src-list="dataForm.imgDesFitnessFacilities">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="雨污水井" prop="desRainwaterWells">
							<!-- <el-select v-model="dataForm.desRainwaterWells" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desRainwaterWells" placeholder="请输入雨污水井" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desRainwaterWells)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desRainwaterWells')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desRainwaterWells')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesRainwaterWells" list-type="picture" :preview-src-list="dataForm.imgDesRainwaterWells">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="儿童游乐场" prop="desPlayground">
							<!-- <el-select v-model="dataForm.desPlayground" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desPlayground" placeholder="请输入儿童游乐场" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPlayground)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPlayground')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPlayground')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesPlayground" list-type="picture" :preview-src-list="dataForm.imgDesPlayground">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="水箱间" prop="desWaterTank">
							<!-- <el-select v-model="dataForm.desWaterTank" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desWaterTank" placeholder="请输入水箱间" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desWaterTank)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desWaterTank')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desWaterTank')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesWaterTank" list-type="picture" :preview-src-list="dataForm.imgDesWaterTank">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="变电所" prop="desSubstation">
							<!-- <el-select v-model="dataForm.desSubstation" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desSubstation" placeholder="请输入变电所" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desSubstation)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desSubstation')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desSubstation')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesSubstation" list-type="picture" :preview-src-list="dataForm.imgDesSubstation">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="公共照明" prop="desPublicLighting">
							<!-- <el-select v-model="dataForm.desPublicLighting" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desPublicLighting" placeholder="请输入公共照明" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPublicLighting)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPublicLighting')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPublicLighting')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesPublicLighting" list-type="picture" :preview-src-list="dataForm.imgDesPublicLighting">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="路面" prop="desPavement">
							<!-- <el-select v-model="dataForm.desPavement" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desPavement" placeholder="请输入路面" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPavement)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPavement')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPavement')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesPavement" list-type="picture" :preview-src-list="dataForm.imgDesPavement">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="公共区域" prop="desPublicAreas">
							<!-- <el-select v-model="dataForm.desPublicAreas" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desPublicAreas" placeholder="请输入公共区域" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPublicLighting)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPublicAreas')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPublicAreas')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesPublicAreas" list-type="picture" :preview-src-list="dataForm.imgDesPublicAreas">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>

				</el-row>
				<el-row :gutter="20">
					<el-col :span="12">
						<el-form-item label="楼宇门" prop="desBuildingDoors">
							<!-- <el-select v-model="dataForm.desBuildingDoors" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desBuildingDoors" placeholder="请输入楼宇门" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desBuildingDoors)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desBuildingDoors')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desBuildingDoors')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesBuildingDoors" list-type="picture" :preview-src-list="dataForm.imgDesBuildingDoors">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="泵房" prop="desPumpRoom">
							<!-- <el-select v-model="dataForm.desPumpRoom" placeholder="请选择状态">
								<el-option v-for="item in options" :key="item.value" :label="item.label"
									:value="item.value">
								</el-option>
							</el-select> -->
							<el-input v-model="dataForm.desPumpRoom" placeholder="请输入泵房" clearable
								:style="{ width: '100%' }" :maxlength="10"
								@input="/^\d+(.\d{1,2})?$/.test(dataForm.desPumpRoom)"></el-input>
							<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
								:on-remove="(response, file, fileList) => handleRemove(response, file, fileList, 'desPumpRoom')" :before-remove="beforeRemove"
								:on-success="(response, file, fileList) => handleAvatarSuccess(response, file, fileList, 'desPumpRoom')"
								:on-change="onChange" multiple :limit="5" :on-exceed="handleExceed"
								:file-list="dataForm.imgDesPumpRoom" list-type="picture" :preview-src-list="dataForm.imgDesPumpRoom">
								<el-button size="small" type="primary">点击上传</el-button>
							</el-upload>
						</el-form-item>
					</el-col>
				</el-row>
				<!-- <el-col :span="24">
					<el-form-item label="上传文件">
						<el-upload class="upload-demo" :action="fileUrl" :on-preview="handlePreview"
							:on-remove="handleRemove" :before-remove="beforeRemove"
							:on-success="handleAvatarSuccess" :on-change="onChange" multiple :limit="5"
							:on-exceed="handleExceed" :file-list="fileList" list-type="picture" :preview-src-list="fileList">
							<el-button size="small" type="primary">点击上传</el-button>
						</el-upload>
					</el-form-item>
				</el-col> -->
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="visible = false">取 消</el-button>
				<el-button type="primary" @click="submitProduct()">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	import {
		flowInspectionDay,
		insertFlowInspectionDay,
		editFlowInspectionDay,
		deleteFlowInspectionDay
	} from '@/api/wuye.js'
	// 上传文件
	import fileUpdata from '@/api/file.config'
	export default {
		name: "product",
		// 页面数据
		data() {
			return {
				queryParams: {
					pageNum: 1, // 显示第一页数据
					pageSize: 10, //每页显示十条
				},
				dataForm: {
					id: "",
					block: "",
					seqNo: "",
					desFitnessFacilities: "",
					desRainwaterWells: "",
					desWaterTank: "",
					desSubstation: "",
					desPublicLighting: "",
					desPavement: "",
					desPublicAreas: "",
					desBuildingDoors: "",
					desPumpRoom: "",
					desPlayground: "",
					createBy: "",
					createTime: "",
					updateBy: "",
					updateTime: "",
					remark: "",
					imgDesFitnessFacilities: [],
					imgDesRainwaterWells: [],
					imgDesPlayground: [],
					imgDesWaterTank: [],
					imgDesSubstation: [],
					imgDesPublicLighting: [],
					imgDesPavement: [],
					imgDesPublicAreas: [],
					imgDesBuildingDoors: [],
					imgDesPumpRoom: [],
				},
				options: [{
					value: '未完成巡检',
					label: '未完成巡检'
				}, {
					value: '已完成巡检',
					label: '已完成巡检'
				}],
				value: '',
				loading: false,
				list: [],
				total: 0, // 一共多少条数据
				timeModel: [],
				visible: false,
				detailModel: false,
				rules: {
					productName: [{
						required: true,
						message: "请您输入业主档案名称",
						trigger: "blur"
					}],
				},
				fileHeaders: fileUpdata.headers(),
				fileUrl: "/special/dictionary/files/upload/",
				fileList: [],
				deleteName: [],
				imgDesFitnessFacilities1: [],
				imgDesRainwaterWells1: [],
				imgDesPlayground1: [],
				imgDesWaterTank1: [],
				imgDesSubstation1: [],
				imgDesPublicLighting1: [],
				imgDesPavement1: [],
				imgDesPublicAreas1: [],
				imgDesBuildingDoors1: [],
				imgDesPumpRoom1: [],
			};
		},
		// 初始化
		mounted() {
			this.getList();
		},
		// 函数集合
		methods: {
			// 下载文件
			downLoadProjectFile(row) {
				this.getBlob(row.filePath, (blob) => {
					this.saveAs(blob, row.fileName)
				})
			},
			getBlob(url, cb) {
				var xhr = new XMLHttpRequest;
				xhr.open('GET', url, true);
				xhr.responseType = 'blob';
				xhr.onload = function() {
					if (xhr.status == 200) {
						cb(xhr.response)
					}
				}
				xhr.send();
			},
			saveAs(blob, fileName) {
				if (window.navigator.msSaveOrOpenBlob) {
					navigator.msSaveBlob(blob, fileName)
				} else {
					const link = document.createElement('a')
					const body = document.querySelector('body')
					link.href = window.URL.createObjectURL(blob)
					link.download = fileName
					link.style.display = 'none'
					body.appendChild(link)
					link.click()
					body.removeChild(link)
					window.URL.revokeObjectURL(link.href)
				}
			},
			// 删除文件
			deleteProjectFile(row) {
				var that = this;
				that.$message.success("文档操作成功")
			},
			handleAvatarError(res, file) {
				this.$message.error("文件上传失败，请重试")
			},
			// 修改巡查档案
			editProduct(row) {
				var type = "";
				console.log('row',row)
				this.deleteName = []
				if (row.id) {
					// 修改
					type = "edit";
					this.dataForm = row;
					console.log(this.dataForm.imgDesFitnessFacilities)
					if (this.dataForm.imgDesFitnessFacilities != undefined) {
						this.dataForm.imgDesFitnessFacilities = JSON.parse(this.dataForm.imgDesFitnessFacilities);
						this.dataForm.imgDesFitnessFacilities.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesRainwaterWells != undefined) {
						this.dataForm.imgDesRainwaterWells = JSON.parse(this.dataForm.imgDesRainwaterWells);
						this.dataForm.imgDesRainwaterWells.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesPlayground != undefined) {
						this.dataForm.imgDesPlayground = JSON.parse(this.dataForm.imgDesPlayground);
						this.dataForm.imgDesPlayground.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesWaterTank != undefined) {
						this.dataForm.imgDesWaterTank = JSON.parse(this.dataForm.imgDesWaterTank);
						this.dataForm.imgDesWaterTank.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesSubstation != undefined) {
						this.dataForm.imgDesSubstation = JSON.parse(this.dataForm.imgDesSubstation);
						this.dataForm.imgDesSubstation.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesPavement != undefined) {
						this.dataForm.imgDesPavement = JSON.parse(this.dataForm.imgDesPavement);
						this.dataForm.imgDesPavement.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesPublicAreas != undefined) {
						this.dataForm.imgDesPublicAreas = JSON.parse(this.dataForm.imgDesPublicAreas);
						this.dataForm.imgDesPublicAreas.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesBuildingDoors != undefined) {
						this.dataForm.imgDesBuildingDoors = JSON.parse(this.dataForm.imgDesBuildingDoors);
						this.dataForm.imgDesBuildingDoors.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
					if (this.dataForm.imgDesPumpRoom != undefined) {
						this.dataForm.imgDesPumpRoom = JSON.parse(this.dataForm.imgDesPumpRoom);
						this.dataForm.imgDesPumpRoom.forEach(item => {
							item.url = 'https://www.ansteelproperty.com' + item.url;
						});
					}
				} else {
					// 新增
					type = "add";
					this.dataForm = {};
				}
				this.visible = true;
			},
			// 查看业主档案详情
			lookProduct(row) {
				this.dataForm = row;
				this.detailModel = true;
			},
			// 删除业主档案
			delProduct(row) {
				this.$confirm("是否删除？", "提示", {
						confirmButtonText: "确 认",
						cancelButtonText: "取 消"
					})
					.then(() => {
						deleteFlowInspectionDay({
							...row
						}).then(res => {
							if (res.code == 200) {
								this.$message({
									message: res.msg,
									type: 'success',
									duration: 1000,
									onClose: () => {
										this.visible = false;
										this.getList();
									},
								});
							}
						})
					})
					.catch(() => console.info("操作取消"));
			},
			//提交业主档案
			submitProduct() {
				var that = this;
				var number = "";
				// for (var i = 0; i < that.buildings.length; i++) {
				// 	if (that.buildings[i].id == that.dataForm.block) {
				// 		that.dataForm.building = that.buildings[i].number;
				// 	}
				// }
				let getId = this.deleteName.map(item => item.name)
				console.log('getId',getId)
				if(getId != []){
					this.dataForm.imgDesFitnessFacilities = this.imgDesFitnessFacilities1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesRainwaterWells = this.imgDesRainwaterWells1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesPlayground = this.imgDesPlayground1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesWaterTank = this.imgDesWaterTank1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesSubstation = this.imgDesSubstation1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesPublicLighting = this.imgDesPublicLighting1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesPavement = this.imgDesPavement1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesPublicAreas = this.imgDesPublicAreas1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesBuildingDoors = this.imgDesBuildingDoors1.filter(item => !getId.includes(item.name))
					this.dataForm.imgDesPumpRoom = this.imgDesPumpRoom1.filter(item => !getId.includes(item.name))
				} else {
					this.dataForm.imgDesFitnessFacilities = this.imgDesFitnessFacilities1
					this.dataForm.imgDesRainwaterWells = this.imgDesRainwaterWells1
					this.dataForm.imgDesPlayground = this.imgDesPlayground1
					this.dataForm.imgDesWaterTank = this.imgDesWaterTank1
					this.dataForm.imgDesSubstation = this.imgDesSubstation1
					this.dataForm.imgDesPublicLighting = this.imgDesPublicLighting1
					this.dataForm.imgDesPavement = this.imgDesPavement1
					this.dataForm.imgDesPublicAreas = this.imgDesPublicAreas1
					this.dataForm.imgDesBuildingDoors = this.imgDesBuildingDoors1
					this.dataForm.imgDesPumpRoom = this.imgDesPumpRoom1
				}
				this.$refs['form'].validate(valid => {
					if (valid) {
						if (this.dataForm.id) {
							editFlowInspectionDay({
								...this.dataForm
							}).then(res => {
								if (res.code == 200) {
									this.$message({
										message: res.msg,
										type: 'success',
										duration: 1000,
										onClose: () => {
											this.visible = false;
											this.getList();
										},
									});
								}
							})
						} else {
							insertFlowInspectionDay({
								...this.dataForm
							}).then(res => {
								if (res.code == 200) {
									this.$message({
										message: res.msg,
										type: 'success',
										duration: 1000,
										onClose: () => {
											this.visible = false;
											this.getList();
										},
									});
								}
							})
						}
					}
				})
			},
			//初始化列表
			getList() {
				this.loading = false;
				flowInspectionDay({
					...this.queryParams
				}).then(res => {
					this.list = res.rows;
					this.total = res.total
				})
			},
			// 上传成功
			handleAvatarSuccess(res, e, x, name) {
				console.log('2222', res)
				console.log('e', e)
				if (res.code == 200) {
					let nameList = []
					var picUrl = res.msg;
					console.log('picUrl',picUrl)
					if(name == 'desFitnessFacilities'){
						nameList.push(picUrl)
						this.dataForm.imgDesFitnessFacilities = nameList
						console.log('nameList',this.imgDesFitnessFacilities)
					} else if(name == 'desRainwaterWells') {
						nameList.push(picUrl)
						this.dataForm.imgDesRainwaterWells = nameList
					} else if(name == 'desPlayground') {
						nameList.push(picUrl)
						this.dataForm.imgDesPlayground = nameList
					} else if(name == 'desWaterTank') {
						nameList.push(picUrl)
						this.dataForm.imgDesWaterTank = nameList
					} else if(name == 'desSubstation') {
						nameList.push(picUrl)
						this.dataForm.imgDesSubstation = nameList
					} else if(name == 'desPublicLighting') {
						nameList.push(picUrl)
						this.dataForm.imgDesPublicLighting = nameList
					} else if(name == 'desPavement') {
						nameList.push(picUrl)
						this.dataForm.imgDesPavement = nameList
					} else if(name == 'desPublicAreas') {
						nameList.push(picUrl)
						this.dataForm.imgDesPublicAreas = nameList
					} else if(name == 'desBuildingDoors') {
						nameList.push(picUrl)
						this.dataForm.imgDesBuildingDoors = nameList
					} else {
						nameList.push(picUrl)
						this.dataForm.imgDesPumpRoom = nameList
					}
					let obj = {
						url: picUrl,
						name: e.name
					}
					if(name == 'desFitnessFacilities'){
						this.imgDesFitnessFacilities1.push(obj)
						console.log('this.imgDesFitnessFacilities1',this.imgDesFitnessFacilities1)
					} else if(name == 'desRainwaterWells') {
						this.imgDesRainwaterWells1.push(obj)
					} else if(name == 'desPlayground') {
						this.imgDesPlayground1.push(obj)
					} else if(name == 'desWaterTank') {
						this.imgDesWaterTank1.push(obj)
					} else if(name == 'desSubstation') {
						this.imgDesSubstation1.push(obj)
					} else if(name == 'desPublicLighting') {
						this.imgDesPublicLighting1.push(obj)
					} else if(name == 'desPavement') {
						this.imgDesPavement1.push(obj)
					} else if(name == 'desPublicAreas') {
						this.imgDesPublicAreas1.push(obj)
					} else if(name == 'desBuildingDoors') {
						this.imgDesBuildingDoors1.push(obj)
					} else {
						this.imgDesPumpRoom1.push(obj)
					}
				}
			},
			// 删除图片
			handleRemove(file) {
				let obj = {
					name: file.name
				}
				this.deleteName.push(obj)
				console.log(this.deleteName)
			},
			onChange(file, fileList) {
				console.log('111', fileList);
			},
			handlePreview(file) {
				console.log(file);
			},
			handleExceed(files, fileList) {
				this.$message.warning(`当前限制选择 10个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
			},
			beforeRemove(file, fileList) {
				return this.$confirm(`确定移除 ${ file.name }？`);
			},
			reset() {
				this.queryParams = {
					pageNum: 1,
					pageSize: 10
				}
			},

		}
	}
</script>
<style scoped lang='scss'>
	.editBtn span {
		color: red;
	}

	.deleteBtn span {
		color: red;
	}

	.detailBtn span {
		color: red;
	}

	.el-date-editor.el-input,
	.el-date-editor.el-input__inner {
		width: 100%;
	}

	.detailForm {
		.el-form-item {
			margin-bottom: 0px;
		}
	}
</style>